/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ricm4.ep.tp3;


/**
 *
 * @author fx
 */


public class Generateur {
	public static double exponentielle(double lambda){
		double alea = 0;
		alea = -Math.log(uniforme(0,1))/lambda;
		return alea;
	}
	
	public static double deterministe(double duree){
		return duree;
	}
	
	public static double uniforme(double a, double b){
		double alea;
		double c;
		if(a>b){
			c=b;b=a;a=c;
		}
		alea= Math.random()*(b-a)+a;	
		return alea;
	}
	
	public static double erlang(int k, double lambda){
		double alea = 0;
		for(int i=0; i<k; i++){
			alea+=exponentielle(lambda);
		}
		return alea;
	}
}
